import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VuePrismEditor from 'vue-prism-editor'
import 'vue-prism-editor/dist/VuePrismEditor.css' // import the styles
import 'prismjs'
import 'prismjs/themes/prism.css'

Vue.component('prism-editor', VuePrismEditor)
Vue.config.productionTip = false
Vue.use(ElementUI)

Vue.filter('toDateTime', function (value) {
  return new Date(value).toLocaleTimeString()
})
Vue.mixin({
  data: function () {
    return {
      showLoading: false
    }
  },
  methods: {
    callWithLoading: async function (fun) {
      this.showLoading = true
      await fun()
      this.showLoading = false
    }
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: {App},
  template: '<App/>'
})
